﻿using System;
using System.Collections.Generic;
using System.Runtime.Serialization;
using System.Text;

namespace WPFCABShell.$safeprojectname$.Services.Settings
{
	/// <summary>
	/// Represents a set of settings.
	/// </summary>
	public interface ISettings
	{
		/// <summary>
		/// Gets or sets a setting by its key.
		/// </summary>
		/// <param name="key">
		/// The key under which the setting is stored.
		/// </param>
		/// <returns>
		/// The value of the setting with the specified key.
		/// </returns>
		object this[string key]
		{
			get;
			set;
		}

		/// <summary>
		/// Adds a serialization surrogate for the specified type.
		/// </summary>
		/// <remarks>
		/// <para>
		/// This method is useful in situations where the settings cannot be serialized without using a surrogate.
		/// </para>
		/// </remarks>
		/// <param name="type">
		/// The type for which a serialization surrogate is being added.
		/// </param>
		/// <param name="surrogate">
		/// The serialization surrogate.
		/// </param>
		void AddSerializationSurrogate(Type type, ISerializationSurrogate surrogate);

		/// <summary>
		/// Determines wheter this settings collection contains a setting with the specified key.
		/// </summary>
		/// <param name="key">
		/// The key.
		/// </param>
		/// <returns>
		/// <see langword="true"/> if the setting was found, otherwise <see langword="false"/>.
		/// </returns>
		bool Contains(string key);

		/// <summary>
		/// Adds a setting to this settings collection.
		/// </summary>
		/// <param name="key">
		/// The key for the setting.
		/// </param>
		/// <param name="value">
		/// The value for the setting.
		/// </param>
		void Add(string key, object value);

		/// <summary>
		/// Gets a setting value.
		/// </summary>
		/// <param name="key">
		/// The key for the setting.
		/// </param>
		/// <returns>
		/// The value of the setting.
		/// </returns>
		object Get(string key);

		/// <summary>
		/// Gets a clone of a specified setting.
		/// </summary>
		/// <param name="key">
		/// The key for the setting.
		/// </param>
		/// <returns>
		/// A clone (deep copy) of the setting's value.
		/// </returns>
		object GetClone(string key);

		/// <summary>
		/// Removes a setting from this settings collection.
		/// </summary>
		/// <param name="key">
		/// The key for the setting to remove.
		/// </param>
		void Remove(string key);

		/// <summary>
		/// Saves the settings.
		/// </summary>
		void Save();
	}
}
